package ru.susu.algebra.jtex;
/**
 * @author akargapolov
 * @since: 17.08.2010
 */
public class TexElementWithCode extends TexElementBase
{
	private String _code;
	private boolean _isNumbered = true;

	private TexElementWithCode(String code)
	{
		_code = code;
	}

	@Override
	public String generateContent()
	{
		StringBuffer buffer = new StringBuffer();
		buffer.append("\\").append(_code).append(_isNumbered ? "" : "*").append("{").append(generateSubItemsContent()).append("}");
		return buffer.toString();
	}

	public TexElementWithCode setNotNumbered()
	{
		_isNumbered = false;
		return this;
	}

	public static final String SECTION = "section";

	public static TexElementWithCode section()
	{
		return new TexElementWithCode(SECTION);
	}

	public static final String SUBSECTION = "subsection";

	public static TexElementWithCode subsection()
	{
		return new TexElementWithCode(SUBSECTION);
	}


}
